import java.util.HashSet;
import java.util.Set;

/**
 * @author LKQ
 * @date 2022/2/2 16:02
 * @description 不用set，用数组
 */
public class FormalSolution {
    public static void main(String[] args) {
        FormalSolution solution = new FormalSolution();
        int[] nums = {2, 3, 1, 0, 2, 5, 3};
        solution.findRepeatNumber(nums);
    }
    public int findRepeatNumber(int[] nums) {
        int[] value = new int[nums.length];
        for (int num : nums) {
            if (value[num] == 0) {
                value[num]++;
            }else {
                return num;
            }
        }
        return -1;
    }
}
